<?php 
/**
* @author Oliver Leisalu, Inditel Meedia
* @package DomAr
* @subpackage Parser
*/
class DomArClassParserRecordProperty_SearchIndex extends DomArClassParserRecordProperty {
	
	private $fields;
	
	protected function setOrm( array &$orm ) {
		$this->fields = (array)$orm['fields'];
	}
	
	protected function updateHandlerClassName( DomArClassParser $class ) {
		$class = $this->getClass();
		foreach( $this->fields as $field ) {
			$listener = new DomArClassParserListener('afterset','updateIndex',array() );
			$listener->setPropertyName( $field );
			$listener->setTarget( $this->name );
			$listener->setCallPropertyHandler(true);
			$class->addListener($listener);
		}
		$this->handlerClassName = 'DomArProperty_SearchIndex';
	}
	
	protected function updateCreateHandlerCode( DomArClassParser $class ) {
		$fields = 'array(\''.implode('\',\'',$this->fields).'\')';
		$this->createHandlerCode = "new DomArProperty_SearchIndex('".$this->name."',".$fields.")";
	}

}

?>